var BillMaterialModel = function (material) {
  BaseModel.call(this);
  var self = this;

  var fn = {
    initData: function (material) {
      var fields = ['id', 'materialCode', 'materialType', 'lineNo', 'materialName', 'materialModel', 'color', 'colorDescription',
        'materialFactory', 'feedTotal', 'yltsTotal', 'orderTotal', 'providerName', 'providerNo', 'materialDeptName', 'materialDeptId'
      ];
      self.setDataFromObj(material, fields);

      var feedTotal = self.getData('feedTotal', 'number');
      if (SysUtil.isEmpty(feedTotal)) {
        feedTotal = undefined;
      }
      self.feedTotal = feedTotal;

      var yltsTotal = self.getData('yltsTotal', 'number');
      if (SysUtil.isEmpty(yltsTotal)) {
        yltsTotal = undefined;
      }
      self.yltsTotal = yltsTotal;

      var orderTotal = self.getData('orderTotal', 'number');
      if (SysUtil.isEmpty(orderTotal)) {
        orderTotal = undefined;
      }
      self.orderTotal = orderTotal;

      var type = material.type;
      if (type === 1 || type === 2) {
        var specialRemark = material.specialRemark;
        var flag = SysUtil.checkApproval(specialRemark, {
          lineNo: material.lineNo,
          materialType: material.materialType,
          materialFactory: material.materialFactory,
          isOpraterAdd: material.isOpraterAdd
        });
        if (!flag) {
          type = 0;
        }
      }
      self.type = type;
    }
  };
  fn.initData(material)
};
